<?php
session_start();

if ($_REQUEST['new_text'] == "simulate error")
{
	echo json_encode(array(
		"error" => true
	));
}
else
{
	$_SESSION['datastore_text'] = $_REQUEST['new_text'];
	echo json_encode(array(
		"error" => false,
		"new_text" => $_SESSION['datastore_text']
	));
}
?>